<?php

class Familymember_Plugin_Menus {
	// user_profile
	

	public function onMenuInitialize_familymemberProfileRequest($row) {
		$viewer = Engine_Api::_ ()->user ()->getViewer ();
		$subject = Engine_Api::_ ()->core ()->getSubject ();
		
		if (! $viewer->getIdentity () || $viewer->isSelf ( $subject )) {
			return;
		}
		
		if (Engine_Api::_ ()->familymember ()->isFamilyMember ( $viewer, $subject ) == 2) {
			return array ('label' => 'Approve Family Request', 'icon' => 'application/modules/User/externals/images/friends/add.png', 'route' => 'recent_activity', 'params' => array ('module' => 'activity', 'controller' => 'notifications' ) );
		}
		
		if (Engine_Api::_ ()->familymember ()->isFamilyMember ( $viewer, $subject ) == 0 && $viewer->membership ()->isMember ( $subject )) {
			return array ('label' => 'Send Family Request', 'icon' => 'application/modules/User/externals/images/friends/add.png', 'route' => 'default', 'class' => 'smoothbox', 'params' => array ('module' => 'familymember', 'controller' => 'index', 'action' => 'add', 'id' => $subject->getIdentity () ) );
		}
		
		return false;
	}

}